import Vue from 'vue'
import VueRouter from 'vue-router'
// import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    // 订单确认
    path: '/order-confirm/:shopId',
    name: 'orderConfirm',
    component: () => import('@/views/order-confirm')
  },
  {
    path: '/coupon',
    name: 'Coupon',
    component: () => import('@/views/my/coupon')
  },
  {
    path: '/shop',
    name: 'Shop',
    component: () => import('@/views/my/shop')
  },
  {
    path: '/record',
    name: 'Record',
    component: () => import('@/views/my/record')
  },
  {
    path: '/address',
    name: 'Address',
    component: () => import('@/views/my/address')
  },
  {
    path: '/password',
    name: 'Password',
    component: () => import('@/views/my/password')
  },
  // 登录界面
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login')
  },
  // 主界面
  {
    path: '/',
    // name: 'layout',
    component: () => import('@/views/layout'),
    children: [
      {
        // 首页
        path: '',
        name: 'home',
        component: () => import('@/views/home')
      },
      {
        // 搜索
        path: '/search',
        name: 'search',
        component: () => import('@/views/search')
      },
      {
        // 订单
        path: '/order',
        name: 'order',
        component: () => import('@/views/order'),
        children: [
          {
            // 搜索
            path: '/order/list/:status',
            name: 'order-list',
            props: true,
            component: () => import('../views/order/components/order-list.vue')
          }
        ]
      },
      {
        // 我的
        path: '/my',
        name: 'my',
        component: () => import('@/views/my')
      },
      {
        path: '/my-info',
        name: 'my-info',
        component: () => import('@/views/my/userinfo')
      }
    ]
  },
  {
    path: '/goods/:shopId',
    name: 'goods',
    component: () => import('@/views/goods')
  },
  {
    path: '/my-shoplist',
    name: 'my-shoplist',
    component: () => import('@/views/shop')
  },
  {
    path: '/shop-info/:shopId',
    name: 'edit-shop-info',
    component: () => import('@/views/shop/components/shop-info'),
    props: true
  },
  {
    path: '/shop-info',
    name: 'add-shop-info',
    component: () => import('@/views/shop/components/shop-info')
  },
  {
    path: '/shop-photo/:shopId',
    name: 'shop-photo',
    component: () => import('@/views/shop/components/shop-photo'),
    props: true
  },
  {
    path: '/shop-delivery/:shopId',
    name: 'shop-delivery',
    component: () => import('@/views/shop/components/shop-delivery'),
    props: true
  }
]

const router = new VueRouter({
  routes
})

export default router
